package dialer.ws.base.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "form", schema = "call_center")
@NamedQueries({ @NamedQuery(name = "getFormByState", query = "from Form where estatus=:estatus") })
public class Form implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1820582887551860953L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "id", unique = true, nullable = false)
	private Integer id;

	@Column(name = "nombre", nullable = false)
	private String nombre;

	@Column(name = "descripcion", nullable = false)
	private String descripcion;

	@Column(name = "estatus", nullable = false, columnDefinition = "CHAR(1)")
	private String estatus;

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinTable(name = "campaign_form", schema = "call_center", joinColumns = { @JoinColumn(name = "id_form", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "id_campaign", nullable = false, updatable = false) })
	private List<Campaign> listCampaign;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "form")
	private List<FormField> listFormField;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "form")
	private List<CampaignEntry> listCampaignEntry;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getNombre() {
		return nombre;
	}

	public void setNombre(String nombre) {
		this.nombre = nombre;
	}

	public String getDescripcion() {
		return descripcion;
	}

	public void setDescripcion(String descripcion) {
		this.descripcion = descripcion;
	}

	public String getEstatus() {
		return estatus;
	}

	public void setEstatus(String estatus) {
		this.estatus = estatus;
	}

	public List<Campaign> getListCampaign() {
		return listCampaign;
	}

	public void setListCampaign(List<Campaign> listCampaign) {
		this.listCampaign = listCampaign;
	}

	public List<FormField> getListFormField() {
		return listFormField;
	}

	public void setListFormField(List<FormField> listFormField) {
		this.listFormField = listFormField;
	}

	public List<CampaignEntry> getListCampaignEntry() {
		return listCampaignEntry;
	}

	public void setListCampaignEntry(List<CampaignEntry> listCampaignEntry) {
		this.listCampaignEntry = listCampaignEntry;
	}

}
